package com.ghsc.ghxc.jsb.ui.live.view

import android.content.Context
import android.view.View
import android.widget.LinearLayout
import android.widget.TextView
import com.cn.appcore.ext.getCompatColor
import com.cn.appcore.ext.setSingleClickListener
import com.flyco.roundview.RoundTextView
import com.ghsc.ghxc.jsb.R
import com.lxj.xpopup.core.BottomPopupView

/**
 * 项目：GuoHuaMall
 * 包名：com.ghsc.ghxc.ui.live.view
 * 类名：PutTypeView
 * 创建时间：2023/11/18 19:48
 * 创建人 @author： xiaolin
 * 描述 ：Todo...发布 弹出选择
 */
class PutTypeView (
    context: Context,  tvBtnSub:(type:Int)->Unit,
) : BottomPopupView(context) {



    private val mContext = context
    private var tvBtnSub: (type:Int) -> Unit = tvBtnSub


    override fun getImplLayoutId(): Int {
        return  R.layout.pw_put_type
    }


    var type =1  //直播

    override fun onCreate() {
        super.onCreate()
        var tvBtnNext= findViewById<RoundTextView>(R.id.tvBtnNext)

        var llBtnVideo= findViewById<LinearLayout>(R.id.llBtnVideo)
        var tvTextVideo= findViewById<TextView>(R.id.tvTextVideo)
        var tvVideo= findViewById<RoundTextView>(R.id.tvVideo)

        var llBtnLive= findViewById<LinearLayout>(R.id.llBtnLive)
        var tvTextLive= findViewById<TextView>(R.id.tvTextLive)
        var tvLive= findViewById<RoundTextView>(R.id.tvLive)

        if (type==1 ){
            tvTextVideo.setTextColor(mContext.getCompatColor(R.color.color_a3a3a3))
            tvVideo.visibility=View.INVISIBLE
            tvTextLive.setTextColor(mContext.getCompatColor(R.color.white))
            tvLive.visibility=View.VISIBLE
            tvBtnNext.text="开始直播"
        }else {
            tvTextVideo.setTextColor(mContext.getCompatColor(R.color.white))
            tvVideo.visibility=View.VISIBLE
            tvTextLive.setTextColor(mContext.getCompatColor(R.color.color_a3a3a3))
            tvLive.visibility=View.INVISIBLE
            tvBtnNext.text="开始拍摄"
        }

        llBtnVideo.setOnClickListener {
            //拍视频
            tvTextVideo.setTextColor(mContext.getCompatColor(R.color.white))
            tvVideo.visibility=View.VISIBLE
            tvTextLive.setTextColor(mContext.getCompatColor(R.color.color_a3a3a3))
            tvLive.visibility=View.INVISIBLE
            tvBtnNext.text="开始拍摄"
            type=0
        }
        llBtnLive.setOnClickListener {
            //直播
            tvTextVideo.setTextColor(mContext.getCompatColor(R.color.color_a3a3a3))
            tvVideo.visibility=View.INVISIBLE
            tvTextLive.setTextColor(mContext.getCompatColor(R.color.white))
            tvLive.visibility=View.VISIBLE
            tvBtnNext.text="开始直播"
            type=1
        }

        tvBtnNext.setSingleClickListener {
            tvBtnSub.invoke(type)
            dismiss()
        }
    }
}